Skip to content

Fix for user-defined inlet velocity profile failure#556

Open
ktbolt wants to merge 2 commits into
SimVascular:mainfrom
ktbolt:User-defied-inlet-velocity-profile-fails_555
Open

Fix for user-defined inlet velocity profile failure#556
ktbolt wants to merge 2 commits into
SimVascular:mainfrom
ktbolt:User-defied-inlet-velocity-profile-fails_555

Conversation

@ktbolt
Copy link
Copy Markdown
Collaborator

@ktbolt ktbolt commented May 27, 2026

This is a simple fix for #555.

There is no CI test for a user-defined inlet velocity profile.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.02%. Comparing base (fa058d0) to head (75715f1).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #556   +/-   ##
=======================================
  Coverage   69.02%   69.02%           
=======================================
  Files         181      181           
  Lines       34133    34134    +1     
  Branches     5905     5904    -1     
=======================================
+ Hits        23560    23561    +1     
  Misses      10436    10436           
  Partials      137      137           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hanzhao2020
Copy link
Copy Markdown
Contributor

Looks good to me!

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a solver initialization issue that breaks user-defined inlet velocity profiles (Issue #555) by avoiding an unconditional reallocation of bcType::gx during boundary-condition initialization.

Changes:

  • Preserve previously-read user-defined spatial profile data in lBc.gx by only allocating when it is empty.
  • Prevents user-defined profile values from being reset to zero during bc_ini().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +301 to +305
// lBc.gx may have values set when for example when
// reading in a user-defined profile.
if (lBc.gx.size() == 0) {
lBc.gx.resize(lFa.nNo);
}
Copy link
Copy Markdown
Collaborator

@aabrown100-git aabrown100-git May 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ktbolt is it worth validating that lBc.gx.size() == lFa.nNo if it's not 0?

lBc.gx.resize(lFa.nNo);
//if (.NOT.ALLOCATED(lBc.gx)) ALLOCATE(lBc.gx(lFa.nNo))

// lBc.gx may have values set when for example when
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ktbolt do you have a test you can add for user-defined spatial profile?


// lBc.gx may have values set when for example when
// reading in a user-defined profile.
if (lBc.gx.size() == 0) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, so previously any time a user defined a spatial profile the solver would fail?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aabrown100-git Correct; there are no CI tests for the Spatial_profile_file_path parameter.

Comment on lines +301 to +305
// lBc.gx may have values set when for example when
// reading in a user-defined profile.
if (lBc.gx.size() == 0) {
lBc.gx.resize(lFa.nNo);
}
Copy link
Copy Markdown
Collaborator

@aabrown100-git aabrown100-git May 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ktbolt is it worth validating that lBc.gx.size() == lFa.nNo if it's not 0?

lBc.gx.resize(lFa.nNo);
//if (.NOT.ALLOCATED(lBc.gx)) ALLOCATE(lBc.gx(lFa.nNo))

// lBc.gx may have values set when for example when
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ktbolt do you have a test you can add for user-defined spatial profile?

@ktbolt
Copy link
Copy Markdown
Collaborator Author

ktbolt commented May 30, 2026

@aabrown100-git It might be good to check that lBc.gx.size() == lFa.nNo although in the current code lBc.gx is only resized for lFa.nNo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants